package com.llmcu.source.javase.colection.queue;

import java.util.Deque;
import java.util.LinkedList;

/**
 * 通过LinkedList感受Deque
 *
 * @author liuling
 * @date 2024/12/2 19:58
 */
public class TestDeque {
    public static void main(String[] args) {
        Deque<Integer> deque = new LinkedList<>();
        System.out.println("--------------连续push,往队列中放入一定量数据------------------");
        deque.push(4);
        deque.push(3);
        deque.push(3);
        System.out.println("--------------一直peek，只能看到最后放入的值------------------");
        for (int i = 0; i < 4; i++) {
            System.out.println(deque.peek());
        }
        System.out.println("--------------一直poll，超过个数返回会抛异常-----------------");
        for (int i = 0; i < 4; i++) {
            System.out.println(deque.pop());
        }
    }
}
